import {createRouter, createWebHistory} from 'vue-router';
import Index from "@components/Index.vue";
import Introduction from "@components/Introduction.vue";
import UserIndex from "@components/UserIndex.vue";
import TableDemo from "@components/UserList.vue";
import TagsTable from "@components/TagsList.vue";
import NoticeList from "@components/NoticeList.vue";
import Login from "@components/common/Login.vue";

import TestForm from "@components/Test/TestForm.vue";
import CustomDirective from "@components/Test/CustomDirective.vue";
import TestTable from "@components/Test/TestTable.vue";
import TestDisplay from "@components/Test/TestDisplay.vue";
import TestPinia from "@components/Test/TestPinia.vue";
import TestThree from "@components/Test/TestThree.vue";
import TestBigNumber from "@components/Test/TestBigNumber.vue";
import TestRegion from "@components/Test/TestRegion.vue";
import TestVue from "@components/Test/TestVue.vue";
import TestTransition from "@components/Test/TestTransition.vue";
import TestKeepAlive from "@components/Test/TestKeepAlive.vue";
import TestVueUse from "@components/Test/TestVueUse.vue";


// 注意：路由中的name 属性，不能重复，否则会报警告
const routes = [
    {
        path: '/',
        redirect: '/home/index',
    },
    {
        path: '/login',
        name: '登录',
        redirect: '/login/index',
        children: [
            {
                path: 'index',
                name: '登录表单',
                component: Login,
            },
        ],
    },
    {
        path: '/home',
        name: '首页',
        redirect: '/home/index',
        children: [
            {
                path: 'index',
                name: '数据报表',
                component: Index,
            },
            {
                path: 'introduction',
                name: '平台介绍',
                component: Introduction,
            },
        ]
    },
    {
        path: '/user',
        name: '用户管理',
        redirect: '/user/list',
        children: [
            {
                path: 'list',
                name: '用户列表',
                component: TableDemo,
            },
            {
                path: 'info',
                name: '用户详情',
                component: UserIndex,
            },
        ]
    },
    {
        path: '/tags',
        name: '标签管理',
        redirect: '/tags/list',
        children: [
            {
                path: 'list',
                name: '标签列表',
                component: TagsTable,
            },
        ]
    },

    {
        path: '/notice',
        name: '消息管理',
        redirect: '/notice/list',
        children: [
            {
                path: 'list',
                name: '消息列表',
                component: NoticeList,
            },
        ]
    },
    {
        path: '/test',
        name: '测试',
        redirect: '/test/table',
        children: [
            {
                path: 'table',
                name: '表格测试',
                component: TestTable,
            },
            {
                path: 'form',
                name: '表单测试',
                component: TestForm,
            },
            {
                path: 'customDirective',
                name: '自定义指令',
                component: CustomDirective,
            },
            {
                path: 'testDisplay',
                name: '布局测试',
                component: TestDisplay,
            },
            {
                path: 'testPinia',
                name: '随机点名',
                component: TestPinia,
            },
            {
                path : 'testThree',
                name : '3DThree',
                component : TestThree,
            },
            {
                path: 'testBigNumber',
                name: '大数测试',
                component: TestBigNumber,
            },
            {
                path: 'testRegion',
                name: '富文本测试',
                component: TestRegion,
            },
            {
                path: 'testVue',
                name: 'Vue测试',
                component: TestVue,
            },
            {
                path: 'testTransition',
                name: 'Vue过渡测试',
                component: TestTransition,
            },
            {
                path: 'testKeepAlive',
                name: 'KeepAlive测试',
                component: TestKeepAlive,
            },
            {
                path: 'testVueUse',
                name: 'VueUse测试',
                component: TestVueUse,
            },
        ]
    },
    {
        path : '/g2',
        name : 'G2数据可视化',
        redirect : '/g2/index',
        children : [
            {
                path : 'index',
                name : 'G2',
                component : () => import('@views/G2.vue')
            }
        ]
    }
    // 更多的路由规则...
];

const router = new createRouter({
    history: createWebHistory(),
    routes,
    base: '/',
});

export default router;